TEGL WINDOWS TOOLKIT II - Release II Introductory Package COPYRIGHT 1991 TEGL SYSTEMS CORPORATION ALL RIGHTS RESERVED This is an introductory package for evaluating the TEGL WINDOWS TOOLKIT II. You may use it to create programs on a trial basis. You make not use these programs in a commercial environment or distribute them to others. The commercial version of the TEGL WINDOWS TOOLKIT is provided with royalty-free distribution of compiled applications. What is the TEGL Windows Toolkit II? The TEGL Windows Toolkit II is really three toolkits in one; a graphics interface, a memory manager and a window manager. Together these parts provide a programming environment. What does the TEGL Windows Toolkit II do? The TEGL Windows Toolkit II provides tools for creating eye-appealing, functional and intuitive graphical user interfaces in your programs. Overlapping windows are automatically managed. Window images are saved so the application does not have to redraw a window if it is just moved or uncovered. A window that is resized does have to be redrawn. The overhead of maintaining graphics images in memory is overcome by the virtual memory manager. Your application can also use virtual memory. The TEGL Windows Toolkit II handles all mouse and keyboard activities, this includes all selections of menu items and mouse click areas. For instance, when a user wants to move a window, the TeglSupervisior handles all of the user interaction from the click of the right mouse button on a window to when the button is released to indicate the new position. You may also define your own Event to look after window moves. An Event is a funtion that you write that gets control when the TEGLSupervisor determines that an action has occured. TEGL GRAPHICS INTERFACE The graphics consist of a low level set of routines that look after the initialization and loading of the correct graphics driver, as well as, graphics primitives and a high-level interface that provides traditional graphics features. This high-level interface module, TGraph, is a virtual plug in replacement for the Borland Graphics Interface (BGI). Users familiar with BGI will have little problem utilizing the TEGL Graphics Interface (TGI). This part of the TEGL Windows Toolkit II can be used separately from the rest of the toolkit. There are no dependencies on the memory manager nor the window manager. TEGL VIRTUAL MEMORY MANAGER The memory manager provides two important items: a heap manager that provides blocks of memory greater than 64K and virtual memory so the heap can utilize other memory resources (EMS or hard drive). The memory manager can be used by itself, that is, it has no dependencies on either the graphics tools or the window manager. The programer utilizes the memory manager through a handle. The memory allocated this way can be swapped out (to disk or EMS) to satisfy other requests, then swapped back in when needed. When working with larger graphics buffers virtual memory becomes a necessity. Generally you can ignore the virtual memory manager since it works tranparently with the window manager. You only need to use it if your application will need to use virtual memory. TEGL WINDOW MANAGER The window manager uses both TEGL graphics and the virtual memory manager. A primary job of the window manager is to look after the graphics image on each window and to keep track of where a window is located on the stack. When a window is moved, brought to the top of the stack or disposed of, then the window manager determines which screen image has to be restored. This may involve resolving many image fragments from numerous windows, fortunately this is done automatically and the programmer needn't concern himself with it. When the window manager is processing graphic images and there are a number of windows displayed, RAM memory may not be sufficient to do all the processing and virtual memory is used. Progamming with the TEGL Windows Toolkit II requires a different strategy than traditional structured programming. This doesn't mean that your programs will be un-structured, just that the hierarchy will be less straight forward, but more dynamic. INITIALIZATION There are several items to set for optomizing the system at start-up. * window manager resolution * standard heap size * reserved heap size * video mode * registering a driver The window manager resolution determines the minimum amount of memory required by the virtual memory manager to process images. Roughly it require twice what the resolution is set to. See WINDOW MANAGER. You must specify how much memory you will need for standard heap use. Be sure to allow for the amount of memory that the compiler functions will require. In particular buffered I/O in C can need a fair bit. If unsure about memory requirements then you should code some monitoring functions that watch this. The function to call to set the heap use is: SetStandardHeapSize( heapsize : LongInt ); The next function does the video startup and sets the initial amount of the huge heap. TeglInit( VideoModeName : string; HugeMinimum : LongInt ); The videomodename is the required mode to startup in, (see videoautodetect and video modes which follows) and hugeminimum is the initial size of the huge heap reserverd area. VideoAutoDetect; This function will autodetect the graphics hardware and return the appropriate video mode name. Note that Super VGA modes cannot be autodetected. If your program is designed to work with one of these then it should have an override or be installable for that mode. A safe start up for a program would be: MaxWindowSize = $00008000; {-- 32 K} SetStandardHeapSize($FFFF); {-- 64 K} TeglInit(VideoAutoDetect,$4000); Then adjust the values to find the optimum. Set maxwindowsize to the highest possible value for best performance. For simplified startup (as most of the example programs use) just use either EasyTegl or twEasyStart as the first call in the main body of your program. --------------------------------------------------------------- EVENTS --------------------------------------------------------------- Events are mouse clicks and key presses. There can also be timer-events but these are more tricky. When an event occurs TeglSupervisor (the event supervisor) calls an event-handler. Event-handlers are always far calls. They must either be declared in the interface, be preceded by the {$F+} compiler directive or be declared with the far directive FAR (only available in Turbo Pascal 6.0 and Stonybrooke Pascal+). The declaration of an event-handler is: {$F+} function myevent(ifs : imagestkptr, ms mouseclickptr): word; begin end; The parameters ifs and ms tell use what frame this event was called from and the corresponding mouse click area on that frame. Depending on what an event-handler needs to know these items contain information that is useful. The ImageStkPtr is always the from the frame the mouse click area orginated from. Sometimes there may be related frames, in this case that frame is passed in the related stack. It can be accessed by using ifs^.relatedstack. Event-handlers are called from menu selections, keypresses, mouse clicks, button presses (a variant of mouse click), and timer ticks. --------------------------------------------------------------- TEXT and FONTS SYSTEM --------------------------------------------------------------- The TELG WINDOWS TOOLKIT II uses fast bit-mapped fonts and can also use the BGI vector fonts. SetTeglFont(font: Pointer); Set the font that will be used in subsequent text output. To use the f8x8bold you would type in: SetTeglFont(@f8x8bold); Note the address of operator! The fonts are stored as external procedures to get around the 64K data area limit. GetTeglFont: Pointer; Returns the currently set font. The names of the available fonts follow. These are contained in the unit TEGLFONT. pc3270, apls7, brdwx19, broadway, countdwn, fraktur, gaelic, georgian, italic, lcdfont, light14, light9, litalic, m3270, ocr, sansx19, script2, script, wndws19, ega09, font14, font07, font07cp, font09, future, oenglish, pc24, pc9, f8x12nor, f8x12bol, f8x8norm, f8x8bold, f8x8ital, f7x7norm, f7x7bold, f6x6norm, f5x6norm Procedure OutTeglTextXY(x, y: Integer; Str: String); x, y are the coordinates to place the text at. Str is the string for output. The font used is the currently set font. This routine is affected by the justification settings set by SetTextJustify and color by SetColor. Only bit-mapped fonts are output by OutTeglTextXY. SetProportional(OnOff: Boolean); This sets proportional spacing for bit-mapped fonts. If it is set to FALSE then the characters are spaces at 8 bits. --------------------------------------------------------------------- END QUICK.TXT